

from .base import Content, ContentImage, ContentText
import json

class Conversation:

    def __init__(self) -> None:
        self.contents:list[Content] = []
    
    def __str__(self) -> str:
        out = self.to_dict()
        return json.dumps(out,ensure_ascii=False,indent=4)
    
    def Add(self, content: Content):
        self.contents.append(content)
    
    def to_dict(self) -> list[dict]:
        return [content.to_dict() for content in self.contents]
    
    def to_json(self) -> str:
        return json.dumps(self.to_dict())
    
    def get_image_path_list(self) -> list[str]:
        return [image_path for content in self.contents for image_path in content.get_image_path_list()]
    

